package com.wy.common;

import lombok.Data;

/**
 * 作者：王昭贵
 * 日期：2023/1/23
 */

public enum GoodTypeEnum {
    ONE(1,"主粮零食"),
    ZERO(2,"医疗保健"),
    TWO(3,"美容日用"),
    FOUR(4,"出行"),
    ;
    GoodTypeEnum(int id, String name) {
        this.id = id;
        this.name = name;
    }

    private int id;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String name;

    //通过ID获取枚举值
    public static GoodTypeEnum getById(Integer id) {
        if(id == null){
            return null;
        }
        for(GoodTypeEnum v : values()) {
            if(v.id == id) {
                return v;
            }
        }
        return null;
    }

}
